<?php

namespace App\Jobs;

use Illuminate\Bus\Queueable;
use Illuminate\Queue\SerializesModels;
use Illuminate\Queue\InteractsWithQueue;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Foundation\Bus\Dispatchable;
use App\Services\WxTemplatemsgService;

/**
 * 微信模板消息发送处理
 * @package App\Jobs
 */
class WxTemplateSend implements ShouldQueue
{
    use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;

    protected $templateKey;
    protected $sendData;
    /**
     * Create a new job instance.
     *
     * @return void
     */
    public function __construct($templateKey, $sendData)
    {
        $this->templateKey = $templateKey;
        $this->sendData = $sendData;
    }

    /**
     * Execute the job.
     *
     * @return void
     */
    public function handle(WxTemplatemsgService $wxTemplate)
    {
        $wxTemplate->send($this->templateKey, $this->sendData);
    }
}
